package com.tianqu.tms.www.check.action;

import java.io.UnsupportedEncodingException;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;

import com.tianqu.tms.core.base.TmsAjaxAction;
import com.tianqu.tms.core.base.UserContext;
import com.tianqu.tms.core.exception.TmsException;
import com.tianqu.tms.entity.TransferAcceptedInfo;

public class CheckCarPrintCheckLicenseAjaxAction extends TmsAjaxAction {

	@Override
	public void process(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response,
			UserContext uc) throws TmsException {

		String carLicense="";
		try {
			carLicense = new String(request.getParameter("carLicense").getBytes("ISO8859-1"), "UTF-8");
		} catch (UnsupportedEncodingException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

		TransferAcceptedInfo accept = new TransferAcceptedInfo();
		accept = accept.getAcceptInfoBySerial("", carLicense);
		String str = "0";	
		if(accept!=null)
		{
			//有重复 过户完了
			if(accept.getStatus()!=0 && accept.getStatus()!=16)
			{
				//修改后的车牌号码处于过户状态，无法进行修改！
				str = "1";
			}
		}
			
		String responseText = str.toString();
		responseValues(response, responseText, TEXT);
	}
}
